<template>
	<view class="qrcode">
		<view class="title">
			推荐码页面
		</view>
		<view class="qrcode-img">
			
			<image :src="qrcode.qrcode" mode="widthFix"></image>
			
		</view>
	</view>
</template>

<script>
const appInstance = getApp();
export default {
	data:function(){
		
		return {
			
			qrcode:{},
		}
	},
	onLoad( options ) {
		var that = this;
		var host = appInstance.globalData.api_host.split('/app')[0];

		appInstance.globalData.checkUserStatus();
		this.init(options);
	},
	onPullDownRefresh() {
	    console.log('refresh');
		var t = this;
	    setTimeout(function () {
			t.init();
	        uni.stopPullDownRefresh();
	    }, 1000);
	},
	methods:{

		init:function(){
			
			//todo 获取专属推荐二维码
			var t = this;
			var url = '&r=member.xcx.myQrcode';
			var data = {
				// status: params.status
			};
			
			appInstance.globalData.request(url, data, "GET", res => {
				
				if( res.data.status ){
					uni.showToast({
						title: res.data.description,
						icon: 'none',
						duration: 1800
					});
				}else{
					t.qrcode = res.data.data;
				}

			});
		}
		
	}
			
}
</script>

<style lang="less">
	@import './login.less';
</style>
